package com.fable.ntzw_ga.entity;

import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.annotations.Table;

import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;

@Data
@EqualsAndHashCode(callSuper = false)
@Entity
@IdClass(Guest.primaryKey.class)
@Table(appliesTo = "guest",comment="酒席来宾表")
@Accessors(chain = true)
public class Guest {

    @Data
    static class primaryKey implements Serializable {
        private String id;
        private String feastTypeId;
    }

    @Id
    @TableId(type = IdType.ASSIGN_UUID)
    @ApiModelProperty(value = "宾客id")
    @Column(name = "id", columnDefinition = "varchar(32) COMMENT '宾客id'")
    private String id;

    @Id
    @ApiModelProperty(value = "酒席时间id")
    @Column(name = "feast_type_id", columnDefinition = "varchar(36) COMMENT '酒席时间id'")
    private String feastTypeId;

    @ApiModelProperty(value = "姓名")
    @Column(name = "name", columnDefinition = "varchar(36) COMMENT '姓名'")
    private String name;

    @ApiModelProperty(value = "礼金")
    @Column(name = "gift", columnDefinition = "double COMMENT '礼金'")
    private Double gift;

    @ApiModelProperty(value = "礼品")
    @Column(name = "gifts", columnDefinition = "varchar(36) COMMENT '礼品'")
    private String gifts;

    @ApiModelProperty(value = "是否回礼")
    @Column(name = "is_recompense", columnDefinition = "bit(1) COMMENT '是否回礼'")
    private Boolean isRecompense = false;

    @ApiModelProperty(value = "地址")
    @Column(name = "address", columnDefinition = "varchar(36) COMMENT '地址'")
    private String address;

    @ApiModelProperty(value = "备注")
    @Column(name = "remarks", columnDefinition = "text(255) COMMENT '备注'")
    private String remarks;

    @ApiModelProperty(value = "创建时间")
    @Column(name = "create_time", columnDefinition = "datetime(0) COMMENT '创建时间'")
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @ApiModelProperty(value = "修改时间")
    @Column(name = "update_time", columnDefinition = "datetime(0) COMMENT '修改时间'")
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
}
